Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The following dependencies have been updated:
/
from2.0.0
to2.0.1
/
from1.7.4
to1.8.1
lib/ui
from3.1.0
to3.1.2
Details
Dependencies.io has updated danger (a npm dependency in
/
) from2.0.0
to2.0.1
.2.0.1
Dependencies.io has updated prettier (a npm dependency in
/
) from1.7.4
to1.8.1
.1.8.1
link
_
-style emphasis is available (json5 versions available: 1.0.0 #3186 by ikatyang)code
(Delaying update of height and width in Layout #3180 by ikatyang)1.8.0
This release adds Markdown support, a new
--insert-pragma
flag, fixes a number of formatting issues, adds support for some new experimental operators, and improves our editor integration support.Highlights
Markdown Support
Support markdown (#2943) by ikatyang
You can now run Prettier on Markdown files! 🎉
The implementation is highly compliant with the CommonMark spec, and backed by the excellent
remark-parse
package.Word Wrap
One of Prettier's core features is its ability to wrap code at a specified line length. This applies to Markdown too, which means you can maintain nice and clean 80-character-wide Markdown files without having to re-adjust line breaks manually when you add or delete words.
Input:
Output:
Code Formatting
Powered by Prettier's generic "multiparser", Prettier will format code blocks in Markdown! We use the language code provided with the code block to determine which language it is, and thus we can format any language that Prettier supports (including Markdown itself, if you're into that).
Input:
Output:
Lists
When rearranging list items, after running Prettier all the numbers will be fixed!
Tables
Tables will also automatically be adjusted to fit their contents. This could be completely unmaintainable without an automated tool.
Markdown-in-JS
By using either
md
ormarkdown
tagged template literals, you can format markdown code inside JavaScript.CLI
Add option to insert
@format
to first docblock if absent (#2865) by samouriIn 1.7, we added an option called
--require-pragma
to require files contain an/** format */
pragma to be formatted. In order to add this pragma to a large set of files you can now use--insert-pragma
flag.Add
--loglevel
option (#2992) by ikatyangThis nifty feature allows you to opt in (or out) of Prettier's logging. We've also cleaned up the logging substantially since 1.7.
JavaScript
Fix indentation for JSDoc comments (#2470) by maxdeviant
This has been a long-time known issue with Prettier. When formatting code that results in a change of indentation level, the JSDoc comments would end up being out of alignment. We're happy to report this is now fixed!
Print pipeline and nullish-coalescing operators (#3036) by azz
We've added support for two new proposed operators to Prettier: the pipeline operator and the nullish coalescing operator.
The pipeline operator is currently a stage one proposal.
The nullish coalescing operator is another stage one proposal.
This operator is similar to
||
except it only evaluates the right-hand-side if the left isundefined
ornull
, not""
,0
,NaN
, etc.Improved template literal expresions line breaks (#3124) by duailibe
This was another known issue with Prettier, when printing a template literal string with expressions inside that went over the print width, it would wrap the code in weird places inside the expressions. Now, if Prettier needs to insert a line break, it should happen right between
${
and}
.JSX
Don't inline trailing
}
for arrow functions attributes (#3110) by duailibeIn order to align closer to the Airbnb style guide, and since it was never intentionally printed this way, we've moved the
}
from to the next line in JSX. This is more diff friendly, and makes it easier to move code around by shifting lines in your editor.Other Changes
JavaScript
Make the factory detection handle multiple elements (#3112) by vjeux
There was a bug in the heuristic that Prettier uses to determine whether an expression is a factory or not. It now works correctly with longer member expressions.
Handle comments between function name and open paren (#2979) by azz
Printing comments in the right place is an endless challenge 😉. This fix ensures that comments next to function names are re-printed correctly.
Support sequential CallExpressions in member chains (#2990) by chrisvoll
Member chains are one of the most complex parts of Prettier. This PR fixes an issue where repeated calls lead to the next method not being pushed to the next line.
Account for empty lines in long member call chain (#3035) by jackyho112
Previously, Prettier would delete all newlines within a member chain. Now we keep up to one if it's in the source. This is nice for fluent APIs that you want to break up over multiple lines.
Fix issue where first argument is left behind when line breaks (#3079) by mutdmour
This addresses an issue where due to our special object inline behaviour, the indentation missing from the function call.
Break parens for binaries in member expression (#2958) by duailibe
Similarly, there was another edge case where indentation was missing from logical expressions. This is fixed, too.
Prevent breaking MemberExpression inside NewExpression (#3075) by duailibe
There are so many ways to break a line. Some of them look much worse than others. Breaking between in this case looked really weird, so it has been fixed!
Fix array acessors in method chains (#3137) by duailibe
In a method chain we split lines by grouping elements together and accessing an array should be printed in the end of a group instead of the beginning.
Flow and TypeScript
Fix indentation of intersection object types (#3074) by duailibe
This was a minor alignment bug in intersection types, and has now been fixed.
Keep parens around TSAsExpression in ConditionalExpression (#3053) by azz
We missed a case where we need to keep the parenthesis with TypeScript's
as
assertions. This is now fixed.JSX
Collapse multiple JSX whitespaces (#2973) by karl
This fixes up the issue where JSX formatting occasionally needed to be run twice to become stable. This occurred when you had multiple JSX whitespace elements or JSX whitespace followed by a space.
Don't print JSX bracket on same line when it has trailing comments (#3088) by azz
This was an issue with the
--jsx-bracket-same-line
option. Turns out you can't always put the bracket on the same line...CSS
Preserve line breaks in grid declarations (#3133) by duailibe
Prettier will now preserve line breaks included in the source code when formatting the
grid
andgrid-template-*
rules, since those are important to keep in separate lines, but still applies the formatting like other rules (e.g., numbers and quotes).SCSS
Format SCSS maps like CSS rules (#3070) by asmockler
Turns out SCSS maps are much prettier when printed over multiple lines.
CSS-in-JS
Fix formatting styled(Foo).attrs(...)`` (#3073) by existentialism
Prettier will now format the CSS in styled-components code that looks like this:
GraphQL
Prevent formatting GraphQL template literals with expressions (#2975) by duailibe
Prettier doesn't support formatting JavaScript expressions in GraphQL. See #2640 for tracking. There was a bug where formatting an expression lead to invalid code, so we've completely disabled formatting GraphQL when it contains JavaScript expressions until we fully support it.
CLI
Don't use ANSI codes if stdout isn't a TTY (#2903) by Narigo
Previously, piping the output of
--list-different
to other tools was troublesome due to the ANSI color codes we use to show whether a file was modified or not. This PR disables the use of color when Prettier is piped to a different process.Configuration
Use relative paths with CLI (#2969) by ahmedelgabri
This fixes a bug where passing a path starting with
./
to the CLI wouldn't match patterns used in.prettierignore
.After this fix, no files will be written to when executing:
$ prettier --write ./path/to/*.js
Resolve file paths relative to config file (#3037) by azz
This fixes an issue where
.prettierrc
overrides, under certain conditions, were not being respected for absolute paths with theresolveConfig
API.Core
Respect CJK width and Combined Characters (#3003, #3015) by ikatyang
Chinese, Japanese and Korean characters are now considered two characters wide.
#3015 also ensures that combining characters (e.g.
Á
) are counted as one character.Editor Support
Implement getSupportInfo() and use it for inference (#3033) by azz
We've added a new function to the API (
prettier.getSupportInfo([version])
), and the CLI--support-info
. This can be used to interrogate Prettier to find out which languages the current version, or an older version, supports. It also provides useful information such as CodeMirror IDs, tmScopes, etc, which can be used to automate some of the work done with lookup tables in text editor integrations.Internally, we use this information to drive which extensions trigger which parsers, and support some common files that don't have extensions, like
.prettierrc
,Jakefile
, etc.# prettier knows that this file is JSON now. $ prettier --write .prettierrc
Split source elements relative to their language. (#3069) by CiGit
This fixes an issue in editors that support range formatting, where formatting an object would cause Prettier to crash.
Thanks! ❤️
Thanks to everyone who contributed to this release, as well as those who raised issues! Prettier has become a highly stable piece of software that a large amount of people trust with their code. We take that trust seriously, and fix rare issues that break code with the highest priority. We can't fix these issues if we don't know about them, so never be afraid to create an issue!
Dependencies.io has updated react-modal (a npm dependency in
lib/ui
) from3.1.0
to3.1.2
.3.1.2